package com.gec.hawaste.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.hawaste.entity.Examine;
import com.gec.hawaste.entity.SysOffice;
import com.gec.hawaste.service.IExamineService;
import com.gec.hawaste.utils.PageInfo;
import com.gec.hawaste.utils.ResultBean;
import com.gec.hawaste.vo.ExamineDo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenxys
 * @since 2022-07-01
 */
@Slf4j
@RestController
@RequestMapping("/manager/examine")
public class ExamineController {
    @Autowired
    private IExamineService examineService;

    /**
     * 考核查询
     * @author chenxys
     * @param current 当前页
     * @param size 每页显示条数
     * @param officeId 所属机构
     * @param name 真实姓名
     * @param type 考核类型
     * @return com.gec.hawaste.utils.ResultBean<com.gec.hawaste.utils.PageInfo>
     */
    @RequestMapping("/select/{current}/{size}")
    public ResultBean<PageInfo> select(@PathVariable("current") Long current,
                                       @PathVariable("size") Long size,
                                       Long officeId,
                                       String name,
                                       String type
                                      ){


        PageInfo<ExamineDo> pageInfo = new PageInfo<>(current,size);

        Map<String,Object> params = new HashMap<String,Object>();
        params.put("officeId",officeId);
        params.put("name",name);
        params.put("type",type);

        pageInfo = (PageInfo<ExamineDo>) examineService.selectByCondition(pageInfo, params);
        pageInfo.setNavigatePage();

        log.info("进入考核查询方法...");
        return ResultBean.ok(pageInfo);
    }
}
